//
//  HMStatusBottomView.swift
//  Weibo
//
//  Created by 米易雅克 on 16/4/19.
//  Copyright © 2016年 米易雅克. All rights reserved.
//

import UIKit

class HMStatusBottomView: UIView {

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        prepareUI()
    }
    //设置子控件
    private func prepareUI() {
    //添加子控件
    addSubview(retweetButton)
    addSubview(commentButton)
    addSubview(likeButton)
    addSubview(separatorViewFirst)
    addSubview(separatorViewSecond)
    
    //添加约束
        
    //转发按钮
    retweetButton.snp_makeConstraints { (make) in
        make.leading.top.bottom.equalTo(self)
        }
    
    //评论按钮
    commentButton.snp_makeConstraints { (make) in
        make.leading.equalTo(retweetButton.snp_trailing)
        make.top.bottom.equalTo(self)
        make.width.equalTo(retweetButton)
        }
    //赞按钮
    likeButton.snp_makeConstraints { (make) in
        make.leading.equalTo(commentButton.snp_trailing)
        make.top.bottom.trailing.equalTo(self)
        make.width.equalTo(commentButton)
        }
    //分割视图
    separatorViewFirst.snp_makeConstraints { (make) in
        make.centerX.equalTo(retweetButton.snp_trailing)
        make.centerY.equalTo(retweetButton)
        }
    separatorViewSecond.snp_makeConstraints { (make) in
        make.centerX.equalTo(commentButton.snp_trailing)
        make.centerY.equalTo(commentButton)
        }
    }
//MARK: 懒加载控件
    //转发按钮
    private lazy var retweetButton: UIButton = UIButton(image: "timeline_icon_retweet", title: "转发")
//    private lazy var retweetButton: UIButton = {
//        let button = UIButton()
//        //设置图片背景
//        button.setBackgroundImage(UIImage.init(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
//        button.setBackgroundImage(UIImage.init(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)
//        //设置按钮图片
//        button.setImage(UIImage.init(named: "timeline_icon_retweet"), forState: UIControlState.Normal)
//        //设置按钮title
//        button.setTitle("转发", forState: UIControlState.Normal)
//        return button
//        
//    } ()
    
    //评论按钮
    private lazy var commentButton: UIButton = UIButton(image: "timeline_icon_comment", title: "评论")
    
//    private lazy var commentButton: UIButton = {
//        let button = UIButton()
//        button.setBackgroundImage(UIImage.init(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
//        button.setBackgroundImage(UIImage.init(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)
//        button.setImage(UIImage.init(named: "timeline_icon_comment"), forState: UIControlState.Normal)
//        button.setTitle("评论", forState: UIControlState.Normal)
//        
//        return button
//        
//    } ()
    
    //赞按钮
    private lazy var likeButton: UIButton = UIButton(image: "timeline_icon_unlike", title: "赞")
    
//    private lazy var likeButton: UIButton = {
//        let button = UIButton()
//        button.setBackgroundImage(UIImage.init(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
//        button.setBackgroundImage(UIImage.init(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)
//        button.setImage(UIImage.init(named: "timeline_icon_like"), forState: UIControlState.Normal)
//        button.setTitle("赞", forState: UIControlState.Normal)
//        
//        return button
//        
//    } ()
    
    
    //分割线
    private lazy var separatorViewFirst: UIImageView = UIImageView(imageNamed: "timeline_card_bottom_line")
    //分割线2
    private lazy var separatorViewSecond: UIImageView = UIImageView(imageNamed: "timeline_card_bottom_line")
}
